package com.wr.hangzhounewlight.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wr.hangzhounewlight.obj.database.SiloRawMaterialMapEntity;
import com.wr.hangzhounewlight.obj.dto.SelectSiloByOrderNoDTO;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author yuanzhizhuo
 * createDate 2025/10/24
 */
public interface SiloRawMaterialMapMapper extends BaseMapper<SiloRawMaterialMapEntity> {

    @Select("""
            select  t1.machine, t1.screw, t2.order_no, t3.ratio_act, t4.silo, t4.raw_material_name
            from device as t1
                     left join `order` as t2 on t1.id = t2.device_id
                     left join recipe as t3 on t2.id = t3.order_id
                     left join silo_raw_material_map as t4 on t1.workshop = t4.workshop and t3.silo = t4.silo
            where t2.order_no = #{orderNo};
            """)
    List<SelectSiloByOrderNoDTO> selectSilo(String orderNo);

}
